#include("/manage/_common/_layout.html")
#@layout()

### ********************************* 定义页面标题
#define title()
修改基本资料
#end

### ********************************* css导入
#define import_css()
#end

### ********************************* js导入
#define import_js()
<script src="#(ctx)/manage/_assets/js/form.js" type="text/javascript"></script>
#end

### ********************************* Body内容区开始
#define main()

<div class="layui-row layui-col-space15">
	<div class="layui-card">
		<div class="layui-card-header">修改基本资料</div>
		<div class="layui-card-body" pad15="">
			<form class="layui-form" action="#(ctx)/manage/admin/baseInfo" method="post">
				<div class="layui-form-item">
					<label class="layui-form-label layui-bg-blue">当前密码</label>
					<div class="layui-input-inline">
						<input type="password" name="oldPassword" lay-verify="required|oldPassword" class="layui-input" autocomplete="off" value="#(oldPassword)">
					</div>
					<div class="layui-form-mid layui-word-aux">修改资料需要输入密码</div>
				</div>
				<hr>
				<div class="layui-form-item">
					<label class="layui-form-label">账户名</label>
					<div class="layui-input-inline">
						<input type="text" name="admin.account" lay-verify="required" class="layui-input layui-disabled" disabled autocomplete="off" value="#(admin.account)">
					</div>
					<div class="layui-form-mid layui-word-aux">不可修改，一般用于后台登入</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-bg-blue">昵称</label>
					<div class="layui-input-inline">
						<input type="text" name="admin.name" lay-verify="required|name" class="layui-input" autocomplete="off" value="#(admin.name)">
					</div>
					<div class="layui-form-mid layui-word-aux">用于站内显示</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">手机</label>
					<div class="layui-input-inline">
						<input type="text" name="admin.mobilePhone" class="layui-input" autocomplete="off" value="#(admin.mobilePhone)">
					</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">电话</label>
					<div class="layui-input-inline">
						<input type="text" name="admin.telephone" class="layui-input" autocomplete="off" value="#(admin.telephone)">
					</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">邮箱</label>
					<div class="layui-input-inline">
						<input type="text" name="admin.email" lay-verify="email" class="layui-input" autocomplete="off" value="#(admin.email)">
					</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<hr>
				<div class="layui-form-item">
					<label class="layui-form-label">新密码</label>
					<div class="layui-input-inline">
						<input type="password" name="newPassword" lay-verify="newPassword" autocomplete="off" id="ID_new_password" class="layui-input" value="#(newPassword)">
					</div>
					<div class="layui-form-mid layui-word-aux">修改密码时才需要输入，6到20个字符</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">确认密码</label>
					<div class="layui-input-inline">
						<input type="password" name="confirmPassword" lay-verify="confirmPassword" autocomplete="off" class="layui-input" value="#(confirmPassword)">
					</div>
					<div class="layui-form-mid layui-word-aux">与新密码相同</div>
				</div>
				<hr>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit="">确认修改</button>
						<button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>

#end
### ********************************* Body内容区结束


### ********************************* 脚本区开始
#define script()
<script>
	layui.use(['jquery', 'layer', 'element', 'form'], function(){
		var $ = layui.jquery, layer = layui.layer,element = layui.element, form = layui.form;

	#if(flashMsg)
		layer.msg("#(flashMsg)");
	#end

		### 自定义验证规则
		form.verify({
			name : function(value, item) {
				if (value.length < 2 || value.length > 20) {
					return '昵称必须6到20位字符';
				}
			},
			oldPassword : function(value, item) {
				if (value.length < 6 || value.length > 20) {
					return '当前密码必须6到20位字符';
				}
			},
			newPassword : function(value, item){
				if($("#ID_new_password").val().length > 0) {
					if (value.length < 6 || value.length > 20) {
						return '新密码必须6到20位字符';
					}
				}
			},
			confirmPassword : function(value, item){
				if($("#ID_new_password").val().length > 0) {
					if (value != $("#ID_new_password").val()) {
						return '确认密码必须和新密码相同';
					}
				}
			}
		});
	});
</script>
#end
### ********************************* JS脚本区结束